ActiveAdmin.register ApiRecord do
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
permit_params "request_path", "request_method", "values", "headers", "remark", "created_at", "updated_at"
#
# or
#
# permit_params do
#   permitted = [:permitted, :attributes]
#   permitted << :other if params[:action] == 'create' && current_user.admin?
#   permitted
# end

form do |f|
  f.inputs 'Details' do
    f.input :request_path, label: "请求路径"
    f.input :request_method, label: "请求方法", hint: "get | post | put  | delete", required: true
    f.input :headers, label: "headers", as: :text, hint: '{ authorization: #auth_token# }'
    f.input :values, label: "values", as: :text
    f.input :remark, label: "接口说明"
    f.input :updated_at, label: "更新时间" if false
  end
  f.actions
  span do
    link_to "开发环境接口", "/requester/development/#{@resource.id}", target: "_blank"
  end
  br br
  span do
    link_to "产品环境接口", "/requester/production/#{@resource.id}", target: "_blank"
  end
end

end
